<?php
class NewThreadForm extends Zend_Form {
    public function __construct($options = null) 
    {
    	$baseurl 	= new MHDEV_View_Helper_BaseUrl();
    	$translate	= Zend_Registry::get('lang');
    	
        parent::__construct($options);
        
        $this->setName('new_thread');
        
        // Title
        $title = new Zend_Form_Element_Text('title');
        $title->setLabel($translate->_('form_thread_title'));
        $title->setRequired(true);
        $title->addValidator('NotEmpty');
        $title->setErrorMessages(array(
            0 => 'Bitte geben Sie einen Titel ein.'
        ));
        $title->setOrder(0);
        
        // Text
        $text = new Zend_Form_Element_Textarea('text');
		$text->setLabel($translate->_('form_thread_text'));
		$text->setRequired(true);
		$text->addFilter('StringTrim');
		$text->addValidator('NotEmpty');
		$text->setAttrib('rows','5');
		$text->setAttrib('cols','30');
		$text->setErrorMessages(array(
            0 => 'Bitte geben Sie einen Beitrag ein.',
        ));
        $text->setOrder(1);
        
        // Captcha 
        /*
        $captcha = new Zend_Form_Element_Captcha('captcha', array(
            'label' => 'Sicherheitscode',
            'captcha' => array(
                'captcha' => 'Image',
                'wordLen' => 6,
                'timeout' => 300,
                'width' => 200,
                'heigth' => 150,
                'imgDir' => 'static/gfx/captcha/',
                'imgUrl' => $baseurl->BaseUrl() . '/static/gfx/captcha/',
                'font' => 'static/gfx/captcha/fonts/gautami.ttf',
                'fontsize' => 28,
        		'messages' => array(
                    'badCaptcha' => 'Der eingegebene Sicherheitscode ist ungültig',
                    'missingID' => 'Der eingegebene Sicherheitscode ist ungültig',
                    'missingValue' => 'Der eingegebene Sicherheitscode ist ungültig'
                )
            )
        ));*/
        
        // Submit
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel($translate->_('form_save'));
        $submit->setOrder(10);
        
        // Cancel
        $cancel	= new Zend_Form_Element_Button('cancel');
        $cancel->setLabel($translate->_('form_cancel'));
        $cancel->setAttrib('onclick', 'window.history.back()');
        $cancel->setOrder(11);
        
        
        $this->addElements(array($title, $text, $submit, $cancel));
    }
}  
?>